<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Blogmer Documentation</title>

<style type='text/css' media='all'>@import url('../css/userguide.css');</style>
<link rel='stylesheet' type='text/css' media='all' href='../css/userguide.css' />

<meta http-equiv='expires' content='-1' />
<meta http-equiv= 'pragma' content='no-cache' />
<meta name='robots' content='all' />
</head>
<body>
<!-- START NAVIGATION -->
<div id="nav"><div id="nav_inner"></div></div>
<div id="nav2"><a name="top">&nbsp;</a></div>
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
<td><h1>Blogmer beta 2</h1></td>
<td id="breadcrumb_right"><a href="table_of_content.html">Table of contents</a></td>
</tr>
</table>
</div>
<!-- END NAVIGATION -->


<!-- START BREADCRUMB -->
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
<td id="breadcrumb">
  <p><a href="http://speedovation.org/" >Speedovation</a> &nbsp;&#8250;&nbsp;
      <a href="../index.html">User Guide Home</a> &nbsp;&#8250;&nbsp;
    Table of contents</p>
  </td>

</tr>
</table>
<!-- END BREADCRUMB -->

<br clear="all" />


<!-- START CONTENT -->
<div id="content">


<h1>Main_model</h1>

<p>Main_model is core of blogmer.It contains all important functions.It generates post, page, feed in readable format from database.Let's discuss each function one by one.</p>

<p class="important"><strong>Beta:</strong>&nbsp; This is an <kbd>Beta</kbd> model. It can be changed anytime.</p>
	
<p>Functions:</p>

<ul>
  <li>SinglePostView($id,$full=false,$title=&quot;&quot;,$checktitle=false)</li>
  <li>PageLinks()</li>
  <li>SinglePage($URLTitle)</li>
  <li> categories($cat,$title,$id)</li>
  <li>archives($date,$id)</li>
  <li>home($posts)</li>
  <li>get_recent_posts($number=10)</li>
</ul>

<p>$id : represents post  id</p>
<h2>Main_model Function Reference</h2>

<h3>$this-&gt;Main_model-&gt;SinglePostView($id,$full=false,$title=&quot;&quot;,$checktitle=false)</h3>
<p>It takes 4 arguments. Only first one is essential. Rest are optional .It generates an array on the basis of 4 arguments.</p>
<p>We've <kbd>||more||</kbd> in blog posts so that we can short entry on home page and shows full when required</p>
<ul>
  <li>$id : It can be number based id or URL Tlitle. Last argument decides by default its a numeric id.</li>
  <li>$full : its a value to decides how to deal with <kbd>||more||</kbd> .By default it leave  portion of content after <kbd>||more||</kbd>.</li>
  <li>$title: URL Title data</li>
  <li>$checktitle=If you supply URL Title and not numeric id then set true. By default FALSE.</li>
</ul>
<p>Array contains:</p>
<ul>
  <li>$blogmer['date']</li>
  <li>$blogmer['post_title']</li>
  <li>$blogmer['post_status']</li>
  <li>$blogmer['content']</li>
  <li>$blogmer['categories']</li>
  <li>$blogmer['author_name']</li>
  <li>$blogmer['title_link']</li>
  <li>$blogmer['comment_link]</li>
  <li>$blogmer['comment_no']</li>
  <li>$blogmer['total_comments']</li>
  <li> $blogmer['full']</li>
  </ul>
<p class="important">On Error :if <kbd>id is not found </kbd>it sets <var>$blogmer['error']</var> to <var>TRUE</var> with <var>$blomer['description']</var></p>
<h3>$this-&gt;Main_model-&gt;PageLinks()</h3>
<p>Generate li based list containing pages list with relative links.</p>
<p>Example output</p>
<pre id="line28">&lt;li&gt;&lt;a href=&quot;blog path/features&quot;&gt;Features&lt;/a&gt;&lt;/li&gt;<br />&lt;li&gt;&lt;a href=&quot;blog path/blogmer-contact&quot;&gt;Contact&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;blog path/about-speedovation&quot;&gt;About Company&lt;/a&gt;&lt;/li&gt;</pre>
<p class="important">I dropped <kbd>&lt;ul&gt;</kbd> part so that we add more external links without touching database.</p>
<p>See this example for better understanding.</p>
<pre id="line">&lt;ul class=&quot;some-custom-class&quot;&gt;
	&lt;li id=&quot;current&quot;&gt;&lt;a href=&quot;external link&quot;&gt;external info&lt;/a&gt;&lt;/li&gt;<br />	&lt;li&gt;&lt;a href=&quot;blog path/features&quot;&gt;Features&lt;/a&gt;&lt;/li&gt;<br />	&lt;li&gt;&lt;a href=&quot;blog path/blogmer-contact&quot;&gt;Contact&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;blog path/about-speedovation&quot;&gt;About Company&lt;/a&gt;&lt;/li&gt;<br />&lt;ul&gt;</pre>
<p>This section can be found in <var>theme/currenttheme/main.php</var></p>
<p></p>
<h3>$this-&gt;Main_model-&gt;SinglePage($URLTitle)</h3>
<p>Dt takes single arguments.  It generates an array on the basis of $URLTitle. </p>
<p>$URLTitle is url title of page</p>
<p>Array contains:</p>
<ul>
  <li>$blogmer['post_title']</li>
  <li>    $blogmer['title_link']</li>
  <li>$blogmer['content']</li>
  </ul>
<p class="important">On Error :if <kbd>id is not found </kbd>it sets <var>$blogmer['error']</var> to <var>TRUE</var> with <var>$blomer['description']</var></p>
<p></p>
<h3>$this-&gt;Main_model-&gt;categories($cat)</h3>
<p>Generate 2d array.</p>
<p>Contains :</p>
<ul>
  <li>$blogmer[$i]['date']</li>
  <li>$blogmer[$i]['post_title']</li>
  <li>$blogmer[$i]['post_status']</li>
  <li>$blogmer[$i]['content']</li>
  <li>$blogmer[$i]['categories']</li>
  <li>$blogmer[$i]['author_name']</li>
  <li>$blogmer[$i]['title_link']</li>
  <li>$blogmer[$i]['comment_link]</li>
  <li>$blogmer[$i]['comment_no']</li>
  <li>$blogmer[$i]['total_comments']</li>
  <li> $blogmer[$i]['full']</li>
</ul>
<p>&nbsp;</p>
<p class="important">Theme function to grab result from this function. It respect <kbd>||more||</kbd> .</p>
<p><code>
			&lt;?php <br />
			<br />
	for($i=0;$i&lt;count($allposts)-1;$i++)	<br />
  			{<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$comments=base_url().'blog/post/'.url_title($allposts[$i]['post_title']).'#comments'; 		   ?&gt; <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;            &lt;h2&gt;&lt;?=$allposts[$i]['title_link'];?&gt;&lt;/h2&gt; <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p class=&quot;post-info&quot;&gt;Posted by &lt;?=$allposts[$i]['author_name'];?&gt; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    | Filed under &lt;?=$allposts[$i]['categories'];?&gt; &lt;/p&gt; 	<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;&lt;?=$allposts[$i]['content'];?&gt;&lt;/p&gt; <br />
            <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&lt;p class=&quot;post-footer&quot;&gt; <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;a href=&quot;&lt;?=$comments?&gt;&quot; class=&quot;comments&quot;&gt;Comments : &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?=$allposts[$i]['comment_no'];?&gt;&lt;/a&gt; | 
            <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;date&quot;&gt;&lt;?=$allposts[$i]['date'];?&gt;&lt;/span&gt;	<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&lt;/p&gt;<br />
            <br />
  &lt;?php	} //end of for loop?&gt;</code></p>
<p>This section can be found in <var>theme/currenttheme/main.php</var></p>
<h3>$this-&gt;Main_model-&gt;archives($date,$id)</h3>
<p>Exaclty above only difference is when we're fetching data from database where condition is changed. For this we compare date basis ouput.</p>
<h3>$this-&gt;Main_model-&gt;home($posts)</h3>
<p>Exaclty above only difference is when we're fetching data from database there no condition.</p>
<h3>$this-&gt;Main_model-&gt;get_recent_posts($number=10)</h3>
<p>It return data from posts. It uses Active Record get function.This function is used by feed controller.</p>
<h2>Final Collection</h2>
<p>
	<code>
    	$this->load->model('Main_model');<br />
        $this->Main_model->SinglePostView($id,$full=false,$title=&quot;&quot;,$checktitle=false);<br />
        $this->Main_model->PageLinks();<br />
        $this->Main_model-&gt;SinglePage($URLTitle);<br />
        $this->Main_model->categories($cat,$title,$id);<br />
	$this-&gt;Main_model-&gt;archives($date,$id);<br />
	$this-&gt;Main_model-&gt;home($posts);<br />
	$this-&gt;Main_model-&gt;get_recent_posts($number=10);</code></p>

</div>
<!-- END CONTENT -->


<div id="footer">
<p><a href="#top">Top of Page</a></p>
<p><a href="http://speedovation.com">Speedovation</a> &nbsp;&middot;&nbsp; Copyright &#169; 2007-2008 &nbsp;&middot;&nbsp; <a href="http://speedovation.org/">Blogmer</a></p></div>

</body>
</html>